<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #div1{
            width:200px;
            height:150px;
            border:1px solid black;
        }
    </style>
    <script>
        window.onload=function(){
            var oTxt=document.getElementById('txt1');
            var oBtn=document.getElementById('btn1');
            var oDiv=document.getElementById('div1');
            oBtn.onclick=function(){
               oDiv.innerHTML=oTxt.value;
               //alert(oDiv.innerHTML);
            };
        };
    </script>
</head>
<body>
<input type="text" id="txt1">
<input type="button" value="设置文字" id="btn1">
<div id="div1">

</div>
</body>
</html>
<!--innnerHTML-->